package pattern5;

/**
 * 各个实例的工厂
 * @author wdl
 */
public class Factory {
}

/**
 * 加法工厂
 */
class AddFactory implements IFactory{

    @Override
    public AbstractOperation createOperation() {
        return new OperationAdd();
    }
}

/**
 * 减法工厂
 */
class SubFactory implements IFactory{

    @Override
    public AbstractOperation createOperation() {
        return new OperationSub();
    }
}

/**
 * 乘法工厂
 */
class MulFactory implements IFactory{

    @Override
    public AbstractOperation createOperation() {
        return new OperationMul();
    }
}

/**
 * 除法工厂
 */
class DivFactory implements IFactory{

    @Override
    public AbstractOperation createOperation() {
        return new OperationDiv();
    }
}
